<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Reservation</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<f:view>
	<div id="page">
	
	<jsp:include page="frame.jsp" /> 
	
	<!-- le corps de la page à 600px -->
	<div id="center"><img src="banniere.gif" width="600" />
	
	<h:form>
	<!-- Voyageurs -->
		<h2>Ajoutez des voyageurs</h2>
		<div class="commandLink" align="center">
			<h:outputLink  value="ajoutvoyageur.jsf" >Ajouter un voyageur</h:outputLink>
		</div>
	<c:if test="${voyageurBean.voyageurs!=null}">
		<h:dataTable id="ListeVoyageurs" value="#{voyageurBean.voyageurs}" 
		var="personne" styleClass="rounded-corner" width="600">
			<f:facet name="header">
				<h:outputText value="Les voyageurs" />
			</f:facet>
			<h:column>
				<f:facet name="header">
        		<h:outputText value="id" />
        		</f:facet> 
        		<h:outputText value="#{personne.id}"></h:outputText>
			</h:column>
			<h:column>
				<f:facet name="header">
        		<h:outputText value="Titre" />
        		</f:facet> 
        		<h:outputText value="#{personne.titre}"></h:outputText>
			</h:column>
			<h:column>
				<f:facet name="header">
        		<h:outputText value="Nom" />
        		</f:facet> 
        		<h:outputText value="#{personne.nom}"></h:outputText>
			</h:column>
			<h:column>
				<f:facet name="header">
        		<h:outputText value="Prenom" />
        		</f:facet> 
        		<h:outputText value="#{personne.prenom}"></h:outputText>
			</h:column>
			<h:column>
				<f:facet name="header">
        		<h:outputText value="Adresse" />
        		</f:facet> 
        		<h:outputText value="#{personne.adresse}"></h:outputText>
			</h:column>
			<h:column>
				<f:facet name="header">
        		<h:outputText value="Email" />
        		</f:facet> 
        		<h:outputText value="#{personne.email}"></h:outputText>
			</h:column>
		</h:dataTable>
	</c:if>
	
	<!-- Selectionnez un vol -->
			<h2>Selectionnez un vol à destination de <h:outputText value="#{commandeBean.nomVilleDestination}" />
		</h2>
		<div class="commandLink" align="center">
			<h:outputLink  value="vol.jsf" >Ajouter un vol</h:outputLink>
		</div>
		<!--<h:commandLink value="Ajoutez un vol" action="#{reservationBean.selectionVol}">
					<f:setPropertyActionListener value="#{hotelSelected.id}" 
												 target="#{hotelBean.idHotelDeleted}" />											 
		</h:commandLink>
		-->
		<c:if test="${volBean.volsChoisis!=null}">
		<h2>Liste des vols choisis</h2>
		<div class="commandLink" align="center">
			<h:dataTable value="#{volBean.volsChoisis}" var="vol" border="1"  styleClass="rounded-corner" width="600">
				<h:column>
					<f:facet name="header" >
						<h:outputText value="date Depart" />
					</f:facet>
					<h:outputText value="#{vol.dateDepart}" >
						<f:convertDateTime type="date" dateStyle="short"/>
					</h:outputText>
				</h:column>
				<h:column>
					<f:facet name="header" >
						<h:outputText value="date Arrivee" />
					</f:facet>
					<h:outputText value="#{vol.dateArrivee}" >
						<f:convertDateTime type="date" dateStyle="short"/>
					</h:outputText>
				</h:column>
				<h:column>
					<f:facet name="header" >
						<h:outputText value="ville Depart" />
					</f:facet>
					<h:outputText value="#{vol.depart.nom}"/>
				</h:column>
				<h:column>
					<f:facet name="header" >
						<h:outputText value="ville Destination" />
					</f:facet>
					<h:outputText value="#{vol.arrivee.nom}"/>
				</h:column>
				<h:column>
					<f:facet name="header" >
						<h:outputText value="prix" />
					</f:facet>
					<h:outputText value="#{vol.prix}" />
				</h:column>
			</h:dataTable>
		</div>
		</c:if>
	
	<!-- Selectionnez une activité -->
			<h2>Selectionnez une activité à <h:outputText value="#{villeBean.nomVilleDestination}" />
		</h2>
		<div class="commandLink" align="center">
			<h:outputLink  value="activite.jsf" >Ajouter une activité</h:outputLink>
		</div>
		<c:if test="${activiteBean.listActiviteSelected != null}">
			
			<h:dataTable value="#{activiteBean.listActiviteSelected}"
				var="activiteSelected" styleClass="rounded-corner" width="600">

				<h:column>
					<f:facet name="header">
						<h:outputText value="Liste des activités selectionnées"></h:outputText>
					</f:facet>
					<h:outputText value="#{activiteSelected.nom}"></h:outputText>
				</h:column>

				<h:column>
					<f:facet name="header">
						<h:outputText value="Prix"></h:outputText>
					</f:facet>
					<h:outputText value="#{activiteSelected.prix}"></h:outputText>
				</h:column>
		
				<h:column>
					<f:facet name="header">
						<h:outputText value=""></h:outputText>
					</f:facet>
					<h:commandLink value="Supprimer" action="#{activiteBean.deleteActivite}">
						<f:setPropertyActionListener value="#{activiteSelected.id}" 
													 target="#{activiteBean.idActiviteDeleted}" />
													 
					</h:commandLink>
				</h:column>
			</h:dataTable>
		</c:if>	
	
	
	<!-- Selectionnez un hotel -->
		<h2>Selectionnez un hotel à <h:outputText value="#{villeBean.nomVilleDestination}" />
		</h2>
		<div class="commandLink" align="center">
			<h:outputLink  value="hotel.jsf" >Ajouter un hotel</h:outputLink>
		</div>
		<c:if test="${hotelBean.listHotelSelected != null}">
			
			<h:dataTable value="#{hotelBean.listHotelSelected}"
				var="hotelSelected" styleClass="rounded-corner" width="600">

				<h:column>
					<f:facet name="header">
						<h:outputText value="Nom"></h:outputText>
					</f:facet>
					<h:outputText value="#{hotelSelected.nom}"></h:outputText>
				</h:column>

				<h:column>
					<f:facet name="header">
						<h:outputText value="Etoiles"></h:outputText>
					</f:facet>
					<h:outputText value="#{hotelSelected.nbEtoile}"></h:outputText>
				</h:column>

				<h:column>
					<f:facet name="header">
						<h:outputText value="Pension"></h:outputText>
					</f:facet>

					<h:outputText value="#{hotelSelected.pension}"></h:outputText>
				</h:column>

				<h:column>
					<f:facet name="header">
						<h:outputText value="Prix"></h:outputText>
					</f:facet>
					<h:outputText value="#{hotelSelected.prix}"></h:outputText>
				</h:column>
				
				<h:column>
					<f:facet name="header">
						<h:outputText value=""></h:outputText>
					</f:facet>
					<h:commandLink value="Supprimer" action="#{hotelBean.deleteHotel}">
						<f:setPropertyActionListener value="#{hotelSelected.id}" 
													 target="#{hotelBean.idHotelDeleted}" />
													 
					</h:commandLink>
				</h:column>
			</h:dataTable>
		</c:if>	

		<h:commandLink action="#{reservationBean.validReservation}" value="Valider Reservation" styleClass="rounded-corner">
			<f:setPropertyActionListener value="#{volBean.volsChoisis}" target="#{reservationBean.volList}" />
			<f:setPropertyActionListener value="#{hotelBean.listHotelSelected}" target="#{reservationBean.hotelList}" />
			<f:setPropertyActionListener value="#{activiteBean.listActiviteSelected}" target="#{reservationBean.activiteList}" />
			<f:setPropertyActionListener value="#{voyageurBean.voyageurs}" target="#{reservationBean.voyageurList}" />
		</h:commandLink>

	</h:form>	
	</div>
	</div>
</f:view>
</body>
</html>